<template>
    <div>
        <div><home-header :city="city"></home-header></div>
        <div><home-swiper :swiperList="swiperList"></home-swiper></div>
        <div><home-icons :icons="icons"></home-icons></div>
        <div><home-scroll :hotbdan="hotbdan"></home-scroll></div>
        <div><home-other :yLikeData="yLikeData"></home-other></div>
        <div><home-where :weekList="weekList"></home-where></div>
        <div><home-middle></home-middle></div>
        
    </div>
</template>
    
<script>
// 引入模板
import HomeHeader from '@/home/components/header'
import HomeSwiper from '@/home/components/swiper'
import HomeIcons from '@/home/components/icons'
import HomeMiddle from '@/home/components/middle'
import HomeOther from '@/home/components/other'
import HomeScroll from '@/home/components/scroll'
import HomeWhere from '@/home/components/where'
//请求数据
import axios from 'axios'
     export default {
        name: "home",
        components:{
          HomeHeader,
          HomeSwiper,
          HomeIcons,
          HomeMiddle,
          HomeOther,
          HomeScroll,
          HomeWhere
        },
        data () {
            return {
                city:"北京",
                swiperList:[],
                icons:[],
                hotbdan:[],
                yLikeData:[],
                weekList:[]
            }
        },
        methods:{
            getHomeInfo(){
                //请求数据
                axios.get('static/moke/index.json').then(this.getSucc)
            },
            getSucc(res){ //对数据进行处理
                var data=res.data; //请求的结果
                // console.log(data)
                if(data.ret && data.data){
                    this.city=data.data.city;
                    this.swiperList=data.data.imgUrl;
                    this.icons=data.data.iconsUrl;
                    this.hotbdan=data.data.hotbdan
                    this.yLikeData=data.data.yLikeData
                    this.weekList=data.data.weekList
                }
            }
        },
        mounted() { //生命周期钩子函数
            this.getHomeInfo()
        }
    }
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="stylus">

</style>
